package com.atguigu.binaryTree;
class Info {
    public int height;
    public int nodes;

    public Info(int h, int n) {
        height = h;
        nodes = n;
    }
}
public class isF {
    public static boolean isFull(TreeNode root){
        if(root==null) return true;
        Info data=process(root);
        return data.nodes==(1<<data.height-1);
    }
    public static Info process(TreeNode x){
        if(x==null){
            return new Info(0,0);
        }
        Info leftData=process(x.left);
        Info rightData=process(x.right);
        int height=Math.max(leftData.height,rightData.height)+1;
        int nodes=leftData.nodes+rightData.nodes+1;
        return new Info(height,nodes);
    }
    }

